import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
import { getWeekMonthQuarterYear } from '/@/utils';
import {initDictOptions} from "@/utils/dict";
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '工厂',
    align:"center",
    dataIndex: 'factoryId_dictText',
    resizable:true
  },
   {
    title: '产品编码',
    align:"center",
    dataIndex: 'goodsNo',
    resizable:true
   },
    {
      title: '产品',
      align:"center",
      dataIndex: 'goodsNo_dictText',
      resizable:true
    },

   {
    title: '关联包材种类',
    align:"center",
    dataIndex: 'num',
    resizable:true
   },
];

//子表表格配置
export const packagingProductRelationColumns: JVxeColumn[] = [

    {
      title: '包材',
      key: 'packagingId',
      type: JVxeTypes.select,
      allowInput:true,
      width:"400px",
      options: [],
      placeholder: '请输入${title}',
      async: true,
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '单位',
      key: 'unit',
      type: JVxeTypes.select,
      width:"100px",
      placeholder: '请输入${title}',
      defaultValue:'',
      dictCode:'unit_code',
      validateRules: [
        { required: true, message: '${title}不能为空' },
      ],
    },
    {
      title: '关联数量(只支持小数后两位)',
      key: 'num',
      type: JVxeTypes.inputNumber,
      width:"250px",
      placeholder: '请输入${title}',
      defaultValue:'',
      validateRules: [
        { required: true, message: '${title}不能为空' },
      ],
    },
  ]

// 高级查询数据
export const superQuerySchema = {
  // goodsNo: {title: '产品编号',order: 0,view: 'sel_search', type: 'string',dictTable: "goods_info", dictCode: 'goods_no', dictText: 'goods_name',},
  // specNo: {title: '规格码',order: 1,view: 'sel_search', type: 'string',dictTable: "goods_info_spec", dictCode: 'spec_no', dictText: 'spec_no',},
  num: {title: '关联包材种类',order: 2,view: 'text', type: 'string',},
  //子表高级查询
  packagingProductRelation: {
    title: '产品绑定的包材',
    view: 'table',
    fields: {
        createBy: {title: '创建人',order: 0,view: 'text', type: 'string',},
        createTime: {title: '创建日期',order: 1,view: 'datetime', type: 'string',},
        updateTime: {title: '更新日期',order: 2,view: 'datetime', type: 'string',},
        goodsNo: {title: '商品编码',order: 3,view: 'sel_search', type: 'string',dictTable: "goods_info", dictCode: 'goods_no', dictText: 'goods_name',},
        num: {title: '关联数量',order: 4,view: 'number', type: 'number',},
        packagingId: {title: '包材',order: 5,view: 'sel_search', type: 'string',dictTable: "p_packaging", dictCode: 'id', dictText: 'name',},
    }
  },
};
